home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 6.9 KB | 240 lines | [TEXT/ttxt] |
- --<<<-
- -- Filename:MakeDoc.sx
-
- -- Other Files Required:
- -- DocFns.sx, which provides functions for creating a document.
- -- DocFns.sx is filed in automatically.
-
- -- Purpose:
- -- MakeDoc.sx was used to create the title container "seadoc.sxt".
- -- This file provides functions for importing media and
- -- creating objects that provide data for a sample Document,
- -- then saves the media and data objects to the object store.
-
-
- -- Specialized Classes:
- -- GlossaryData and MovieData.
- -- GlossaryData instances hold heading, description and
- -- picture for a page
- -- MovieData instances hold heading, description
- -- movie, and copyright info for a page
-
- -- Instructions to User:
- -- You don't need to load this file;
- -- It just shows you how "seadoc.sxt" was created.
- -- If you want to create seadoc.sxt from scratch,
- -- you can load this file
-
-
- -- Author:
- -- Jocelyn Becker
- -- Modified on: 11/13/95 to update to 1.5
-
-
- ------------------------------------------------------------------------
- -- Create the classes to act as data objects for the pages in a document
-
- fileIn theScriptDir name:"docfns.sx"
-
- print "filed in docfns.sx"
-
- class GlossaryData (RootObject)
- instance variables
- heading
- description
- picture
- copyrightInfo:(new string)
- end
-
-
- class MovieData (RootObject)
- instance variables
- heading
- description
- movie
- copyrightInfo:(new string)
- music
- end
-
- -- create a variable to point to the media subdirectory
-
- global theMediaDir := spawn theScriptDir "Media"
-
-
- -- Create the database to be displayed by the document.
- -- In this case its a dictionary of whale-related words.
- -- This functions creates objects that hold a heading, description and picture.
- function makeWhaleGlossaryInstances ->
- (
- local glossary := new array
- local glossaryWord
-
- glossaryWord := new GlossaryData
- glossaryWord.Heading := "Fluking" as Text
- glossaryWord.Description := ("As the whale goes down for a dive, it slaps
- the surface of the water with its fluke (tail)." As Text)
- glossaryWord.picture := importMedia theimportexportengine \
- (getstream theMediaDir "fluke.pic" @readable) \
- @image @pict @bitmap
-
- append glossary glossaryWord
-
- glossaryWord := new GlossaryData
- glossaryWord.Heading := "Breaching" as Text
- glossaryWord.Description := ("The whale jumps clear out of the water in
- one huge thrust." as Text)
- glossaryWord.picture := importMedia theimportexportengine \
- (getstream theMediaDir "breach.pic" @readable) \
- @image @pict @bitmap
-
- append glossary glossaryWord
-
- glossaryWord := new GlossaryData
- glossaryWord.Heading := "Blowing" as Text
- glossaryWord.Description := ("When the whale breathes at the surface,
- its breath turns into a plume of steam." as Text)
- glossaryWord.picture := importMedia theimportexportengine \
- (getstream theMediaDir "blow.pic" @readable) \
- @image @pict @bitmap
-
- append glossary glossaryWord
-
- glossaryWord := new GlossaryData
- glossaryWord.Heading := "Spyhopping" as Text
- glossaryWord.Description := ("The whale lifts its head out of the water to
- look around for a few seconds." as Text)
- glossaryWord.picture := importMedia theimportexportengine \
- (getstream theMediaDir "spyhop.pic" @readable) \
- @image @pict @bitmap
-
- append glossary glossaryWord
-
- print "glossary made"
- return glossary
- )
-
- -- Create more of the database to be displayed by the document.
- -- This functions creates objects that hold a heading, description and movie.
- -- tc is the title container to which to save the imported media
- function makeMovieDataInstances tc ->
- (
- local movieList := new array
- local tempmovie
- local videoStream
-
-
-
- local movie := new MovieData
- movie.Heading := "Humpback Whales" as Text
- movie.description:= ("Humpback whales have baleen instead of
- teeth." as Text)
- videoStream := getstream theMediaDir "whale.mov" @readable
- tempmovie := importMedia theImportExportEngine videoStream \
- @movie @quicktime @interleavedMoviePlayer container: tc
- movie.movie := tempmovie
- movie.music := importMedia theImportExportEngine \
- (getStream theMediaDir "whale.aif" @readable) \
- @sound @aiff @player container:tc
- movie.music.masterclock := movie.movie
-
-
- append movieList movie
-
- movie := new MovieData
- movie.Heading := "Giant Octopii" as Text
- movie.description :=("A giant octopus is a fearsome site for hapless
- scuba divers." as Text)
- videoStream := getstream theMediaDir "octo.mov" @readable
- tempmovie := importMedia theImportExportEngine videoStream \
- @movie @quicktime @interleavedMoviePlayer container: tc
- movie.movie := tempmovie
- movie.copyRightInfo := "Music copyright by ArisMedia"
- movie.music := importMedia theImportExportEngine \
- (getStream theMediaDir "octo.aif" @readable) \
- @sound @aiff @player container:tc
- movie.music.masterclock := movie.movie
-
- append movieList movie
-
- movie := new MovieData
- movie.Heading := "Schooling Fish" as Text
- movie.description := ("Thousands of schooling fish glitter in the
- rays of light that pierce the ocean." as Text)
- videoStream := getstream theMediaDir "fish.mov" @readable
- tempmovie := importMedia theImportExportEngine videoStream \
- @movie @quicktime @interleavedMoviePlayer container: tc
- movie.movie := tempmovie
- movie.copyRightInfo := "Music copyright by ArisMedia"
- movie.music := importMedia theImportExportEngine \
- (getStream theMediaDir "fish.aif" @readable) \
- @sound @aiff @player container:tc
- movie.music.masterclock := movie.movie
-
- append movieList movie
-
- print "movie list made "
- return movieList
- )
-
- -- These are global so we can check that importing was successful
- -- and also save the lists to the title container
- global movieList, glossaryList
-
- -- This is a cover function to import the bitmaps and movies
- -- and create the database
- -- tc is the title container to which to save the imported media
- function doImporting tc ->
- (
- movieList := makeMovieDataInstances (tc)
- glossaryList := makeWhaleGlossaryInstances ()
- )
-
-
- -- This function creates a document to display the ocean data
- function createDoc1 glossaryList movieList pageWidth pageHeight ->
- (
- local doc := makeDocument \
- pageWidth pageHeight \
- glossaryList movieList
-
- local docWindow := new window \
- boundary: (new rect x2: (pageWidth + 20) \
- y2: (pageHeight + 20) ) \
- fill: whitebrush
-
- docWindow.x := 25
- docWindow.y := 45
- doc.x := 10
- doc.y := 10
-
- append docWindow doc
- show docWindow
- goTo doc 1
- return doc
- )
-
- -- Create a title container to hold the media
-
- global tc := new titlecontainer dir:theScriptDir path:"seadoc.sxt" \
- name: "The Sea"
-
- -- Import the media
- print "Now importing the media. Please stay on the line."
- doimporting tc
-
- -- create the document
- -- save the document's window to the title container
- global doc1 := createdoc1 glossaryList movieList 320 400
- goto doc1 1
- append tc doc1.presentedBy
-
- -- append the functions used by the movie buttons
- append tc playmovie
- append tc stopmovie
-
- tc.startUpAction := (tc -> foreach tc load undefined)
-
- -- Close the title
- close tc
-
-